package yy.zn.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;

/**
 * ClassName PageQuery
 *
 * @author Ll
 * @since 2025/6/20
 * Description 分页
 */
public class PageQuery {
    private int page = 1;
    private int size = 10;
    @JsonIgnore
    private Long start;
    @JsonIgnore
    private Long end;

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getSize() {
        return size;
    }

    public void setSize(int size) {
        this.size = size;
    }

    public void build() {
        this.start = 1L + ((long) (this.page - 1) * this.size);
        this.end = (long) this.page * this.size;
    }

    public Long getStart() {
        return start;
    }

    public Long getEnd() {
        return end;
    }

    public static void main(String[] args) {
        PageQuery query = new PageQuery();
        query.setPage(3);
        query.setSize(10);
        query.build();
        System.out.println(query.getStart() + "---" + query.getEnd());
    }
}
